<%@page import="fr.p10.miage.gestionabsence.model.JourBDD"%>
<%@page import="fr.p10.miage.gestionabsence.model.ECBDD"%>
<%@page import="fr.p10.miage.gestionabsence.model.Agenda"%>
<%@page import="java.util.ArrayList"%>
<%@page import="fr.p10.miage.gestionabsence.model.EtudiantBDD"%>
<%@page import="fr.p10.miage.gestionabsence.model.Intervenant"%>
<%@page import="fr.p10.miage.gestionabsence.model.Etudiant"%>
<jsp:useBean id="utilisateur" class="fr.p10.miage.gestionabsence.model.Utilisateur" scope="session"/>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<!DOCTYPE html>
<html lang="fr">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">
        <link rel="shortcut icon" href="">
        <title></title>
        <link href="css/bootstrap.css" rel="stylesheet">
        <link href="css/font-awesome.css" rel="stylesheet">
        <link href="css/index-bo.css" rel="stylesheet">
    </head>
  
    <body class="skin-black fixed">
        <header class="header">
            <a href="accueilEtudiant.jsp" class="logo">MIAGE NANTERRE</a>
            <nav class="navbar navbar-static-top" role="navigation">
                <a href="#" class="navbar-btn sidebar-toggle" data-toggle="offcanvas" role="button">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </a>
                <div class="navbar-right">
                    <ul class="nav navbar-nav">
                        <li class="dropdown user user-menu">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                <i class="glyphicon glyphicon-user"></i>
                                <span><%= utilisateur.getPrenom()%> <%= utilisateur.getNom()%> <i class="caret"></i></span>
                            </a>
                            <ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="dropdownMenu1">
                                <li role="presentation"><a role="menuitem" tabindex="-1" href="profil.jsp"><i class="glyphicon glyphicon-info-sign"></i> Profil</a></li>
                                <li role="presentation"><a href="deconnexion.do" role="menuitem" tabindex="-1"><i class="glyphicon glyphicon-log-out"></i> Déconnexion</a></li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </nav>
        </header>
        <div class="wrapper row-offcanvas row-offcanvas-left">
            <aside class="left-side sidebar-offcanvas">                
                <section class="sidebar">
                    <ul class="sidebar-menu">
                        <li class="treeview">
                            <a href="#">
                                <i class="fa fa-folder"></i> <span>Absence</span>
                                <i class="fa fa-angle-left pull-right"></i>
                            </a>
                            <ul class="treeview-menu">
                                 <%
                                    if (utilisateur instanceof Etudiant) {
                                %>
                                    <li><a href="accueilEtudiant.do"><i class="fa fa-angle-double-right"></i> Aujourd'hui</a></li>
                                    <li><a href="history.jsp"><i class="fa fa-angle-double-right"></i> Historique</a></li>
                                    <li><a href="parametres.jsp"><i class="fa fa-angle-double-right"></i> Paramètres</a></li>
                                <%  
                                    } else if (utilisateur instanceof Intervenant) {       
                                %>
                                    <li><a href="absenceNowIntervenant.do"><i class="fa fa-angle-double-right"></i> Aujourd'hui</a></li>
                                    <li><a href="history.jsp"><i class="fa fa-angle-double-right"></i> Historique</a></li>
                                    <li><a href="parametres.jsp"><i class="fa fa-angle-double-right"></i> Paramètres</a></li>   
                                <% 
                                    }
                                %>  
                            </ul>
                        </li>
                    </ul>
                </section>
            </aside>
            <aside class="right-side">                
                <section class="content-header">
                    <h1>
                        Historique de vos cours et absences <br>
                    </h1>

                    <ol class="breadcrumb">
                        <li><a href="#"><i class="fa fa-folder"></i> Gestion des absences</a></li>
                        <li class="active">Historique</li>
                    </ol>
                </section>
<section class="content">
                    <table class="table table-hover table-striped">
                        <thead>
                            <th>Date</th>
                            <th>Cours</th>
                            <th>Horaire</th>
                            <th></th>
                        </thead>
 <tbody>
        <% 
            if (utilisateur instanceof Etudiant){
                Etudiant e = (Etudiant) utilisateur;
                for( Agenda a : EtudiantBDD.getAbsenceEtudiant(e.getId())){
        %>
        
        <tr>        
            <td><% out.print(JourBDD.trouverParId(a.getIdJ()).getDateE());%></td>
            <td><% out.print(ECBDD.trouverParId(a.getIdEc()).getNom());%></td>
            <td><% out.print(a.getDebutGood()+ " - " + a.getFinGood());
            %>     
        </tr>                             
                       <% }}%>    
                       </tbody>   
                    </table>
                </section>
            </aside>
        </div>
        
        <script src="//code.jquery.com/jquery-1.11.0.min.js"></script> 
        <script src="js/bootstrap.js"/></script>
        <!--[if lt IE 9]>
            <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
            <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
        <![endif]-->
        <script src="js/app.js"/></script>
  </body>
</html>
